<template>
	<view class="u-padding-top-30">
		<!-- {{userInfo}} -->
		<view class="mdx-center-min infoBox u-flex">
			<view>
				<u-avatar size="120" mode='square' :src="userInfo.headimgurl"></u-avatar>
			</view>
			<view class="u-margin-left-20">
				<view class="username">{{userInfo.nickname||'(未命名游客)'}}</view>
				<view class="teamname" @click="$mHelper.to('/pages/task/teamInfo')">
					团队：{{userInfo.team_name||'未加入团队'}}</view>
			</view>
		</view>
		<view class="menuList u-flex mdx-center-min">
			<view v-for="(item,index) in menuList" :key='index' @click="$mHelper.to('/pages/task/task')"
				class="u-text-center u-flex-1">
				<view>
					<u-icon size="70" :name="item.icon"></u-icon>
				</view>
				<view class="u-font-28">
					{{item.title}}
				</view>
			</view>
		</view>
		<view class="menuList u-flex mdx-center-min">
			<view v-for="(item,index) in teamList" :key='index' @click="toPath(item)" class="u-text-center u-flex-1">
				<view>
					<u-icon size="70" :name="item.icon"></u-icon>
				</view>
				<view class="u-font-28">
					{{item.title}}
				</view>
			</view>
		</view>
		<view class="mdx-center-min lineListBox">
			<u-cell-item title="意见反馈" @click="$mHelper.to('/pages/my/feedback/feedback')"></u-cell-item>
			<u-cell-item title="关于我们" @click="$mHelper.to('/pages/my/aboutUs/aboutUs')"></u-cell-item>
		</view>
		<view>

		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				menuList: [{
					icon: '/static/images/my1.png',
					title: '全部任务'
				}, {
					icon: '/static/images/my2.png',
					title: '待审核'
				}, {
					icon: '/static/images/my3.png',
					title: '待提交'
				}, {
					icon: '/static/images/my4.png',
					title: '可提现'
				}],
				teamList: [{
					icon: '/static/images/team1.png',
					title: '我的团',
					path: '/pages/my/myTeam/myTeam'
				}, {
					icon: '/static/images/team2.png',
					title: '领取任务',
					path: '/pages/my/myTeam/myTaskGet'
				}, {
					icon: '/static/images/team3.png',
					title: '领取审核',
					path: '/pages/my/Receive/task'
				}, {
					icon: '/static/images/team4.png',
					title: '提交审核',
					path: '/pages/my/Receive/task'
				}]
			}
		},
		onLoad() {

		},
		onShow() {
			this.getUser()
		},
		computed: {
			userInfo() {
				return this.$store.getters['userinfo']
			}
		},
		methods: {
			getUser() {
				this.$http.post('/api/UsersPublic/getuse', {}, true).then(res => {
					if (res.code == 0) {
						this.$store.commit('saveInfo', {
							userinfo: res.data
						});
					} else {
						this.$store.commit('logout');
					}
					uni.hideLoading();
				})
			},
			toPath(e) {
				// console.log(JSON.stringify(e));
				this.$mHelper.to(e.path)
			}
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #FAFAFA;
	}

	.infoBox {
		background: #FFFFFF;
		box-shadow: 0 0 10rpx #dddddd;
		padding: 25rpx 20rpx;

		.username {
			font-size: 32rpx;
			font-weight: 550;
		}

		.teamname {
			font-size: 26rpx;
			color: #999;
			margin-top: 25rpx;
		}
	}

	.menuList {
		margin-top: 30rpx;
		padding: 30rpx 0;
		background-color: #FFFFFF;
		box-shadow: 0 0 10rpx #dddddd;
		border-radius: 10rpx;
	}

	.lineListBox {
		padding: 0 20rpx;
		margin-top: 30rpx;
		background-color: #FFFFFF;
		box-shadow: 0 0 10rpx #dddddd;
		border-radius: 10rpx;
	}
</style>
